package com.life.util;
import java.io.File;
import java.net.URL;


public class ContextUtil {
	 public static String getWebRootPath(){
		 URL url = Thread.currentThread().getContextClassLoader().getResource("");
		 String pathStr = url.getPath();
		  // 对 Windows 下获取 物理路径 做 特殊处理
		  if("\\".equals(File.separator)) {
		     pathStr = pathStr.substring(1).replaceAll("/", "\\\\");
		 }
		  pathStr = pathStr.substring(0, pathStr.indexOf("WEB-INF"));
		  return pathStr;
	 }
	 
	 
	 public static void main(String[] args) {
		 String folder = DateUtil.getCurrentDate("yyyyMMdd");
		 String folderName = ContextUtil.getWebRootPath()+folder;
		 System.out.println(folderName);
		 File folders = new File(folderName);
		
		 if(folders.exists()){
			
		 }
	}
}
